<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
      <?php
/* 
 *纯PHP代码文件，没有html标签,可以只有<?php   省略 ?>
 * 本代码负责进行数据库连接
 */
header("Content-Type:text/html; charset=utf-8");//防止网页中文乱码
//连接数据库    
$db=new mysqli("localhost","root","","db_bbs");//实例化
if ($db->connect_errno)//检测连接是否出错
{
    die("连接失败！出错原因是".$db->connect_error);//连接出错的提示信息
}
$db->query('set names utf8');//数据库里编码设置为utf-8
?>
    </body>
</html>
